<template>
	<view class="paypwd">
		<u-popup mode="center" :show="payflag" :round="6" @close="closeshow">
			<view class="tankuangpay">
				<view>
					<view>提示</view>
					<view>支付需设置交易密码，请先设置</view>
				</view>
				<view class="smlbummit" @click="toPage('/pages/personal/setpwd')">立即设置</view>
			</view>
		</u-popup>
		<u-popup mode="center" :show="zhifuflag" :round="6" @close="closeshow">
			<view class="tankuangpay" style="width: 620rpx;">
				<view>
					<view>请输入交易密码</view>
					<view class="paymoney" v-if="totalprice">付款{{totalprice}}</view>
					<jpCoded :width="500" :codes="codes" @tokey="toOpen" @inputVal="inputVal" v-if="zhifuflag"></jpCoded>
				</view>
				<view class="smlbummit" @click="$u.throttle(payyemoney, 1000)" style="margin: 30rpx 6% 0;">确认</view>
				<view class="forget" @click="toPage('/pages/personal/setpwd')">忘记密码</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import jpCoded from '@/components/jp-coded/jp-coded.vue'
	export default {
		data() {
			return {
				payflag: false,
				zhifuflag: false,
				codes:'',
				numberpwd:''
			}
		},
		props:['totalprice'],
		methods:{
			closeshow(){
				this.payflag = false
				this.zhifuflag = false
			},
			toOpen() {
				// this.$refs.jpKeyboard.toOpen()
			},
			inputVal(e){
				 this.numberpwd=e
			},
			payyemoney(){
				this.request('/member/verificationPayPassword',{pwd:this.numberpwd}).then(res => {
					if(res.data.code==1){
						this.$emit("paymoney")
					}else{
						this.$tip(res.data.msg)
					}
				})
			},
			toPage(route){
				this.payflag = false
				this.zhifuflag = false
				uni.navigateTo({
				    url: route
				});
			}
		},
		components: {
			jpCoded
		}
	}
</script>

<style scoped lang="scss">
	.paypwd {
		.tankuangpay {
			width: 540rpx;
			padding: 50rpx 0;
			
			>view {
				text-align: center;
				
				&:first-of-type {
					view {
						text-align: center;
						font-size: 32rpx;
						line-height: 40rpx;
		
						&:last-of-type {
							font-size: 28rpx;
							padding-top: 30rpx;
		
							text {
								color: $uni-item-color;
								font-size: 28rpx;
							}
						}
					}
				}
		
				&.agent_con {
					color: #999;
					font-size: 26rpx;
					padding: 20rpx 0;
		
					text {
						color: $uni-text-color;
						font-size: 26rpx;
					}
		
					.icon {
						position: relative;
						top: 6rpx;
						margin-right: 10rpx;
					}
				}
			}
		
			.paymoney {
				font-size: 28rpx !important;
				margin: 20rpx 0;
			}
		
			.smlbummit {
				height: 70rpx;
				margin: 0 14%;
				background: $uni-item-color;
				text-align: center;
				line-height: 70rpx;
				border-radius: 100rpx;
				margin-top: 30rpx;
				font-size: 28rpx;
				color: #fff;
			}
		
			.forget {
				font-size: 26rpx;
				color: #6F90CB;
				margin-top: 20rpx;
			}
		}
	}
</style>
